package com.sicheng.蓝桥.国赛准备.第十三届JavaB;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/18 10:33
 */
public class J {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        init();
        int l = scanner.nextInt();
        int r = scanner.nextInt();

        System.out.println(dp(r) - dp(l - 1));
    }

    //dp(i,j)表示 i位数 最高位为j时满足2022的总和
    static long[][] dp = new long[11][10];

    static void init() {
        int base = 2022;
        dp[4][2] = base;
        Arrays.fill(dp[4], 2, 10, base);
        for (int i = 5; i < dp.length; i++) {
            dp[i][0] = dp[i - 1][9];
            for (int j = 1; j <= 9; j++) {
                dp[i][j] = dp[i][j - 1] + (long) (j * Math.pow(10, i - 1) + dp[i - 1][9]);
            }
        }
    }

    static long dp(long r) {
        if (r < 2022)
            return 0;
        int base = 2022;
        long res = 0;
        if (r < 9999) {
            return 2022;
        } else if (r >= 10000) {
            int x = (int) (r / 10000);
            for (int i = 0; i <= x; i++) {
                res += i * 10000L + base;
            }
            if (x >= 2) {
                for (int i = 0; i < 9; i++) {
                    res += base * 10 + i;
                }
            }
        }

        return res;
    }
}
